package com.wang.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wang.mapper.DevFlagConfMapper;
import com.wang.pojo.DevFlagConf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author wcy
 * @date 2023-06-30 15:08
 */

@Service
@Transactional
public class DevFlagConfServiceImpl extends ServiceImpl<DevFlagConfMapper, DevFlagConf> implements DevFlagConfService {


    @Autowired
    private DevFlagConfMapper devFlagConfMapper;
    @Override
    public List<DevFlagConf> selectDevFlagConf(Integer devId) {

        LambdaQueryWrapper<DevFlagConf> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(DevFlagConf::getDevId,devId);

        return devFlagConfMapper.selectList(queryWrapper);
    }

    @Override
    public void delDEvFlagConf(Integer devFlagConfId) {

        devFlagConfMapper.deleteById(devFlagConfId);
    }

    @Override
    public DevFlagConf selectByDevIdAndCode(Integer devId, String devFlagConfCode) {
        LambdaQueryWrapper<DevFlagConf> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(DevFlagConf::getDevId,devId);
        queryWrapper.eq(DevFlagConf::getDevFlagConfCode,devFlagConfCode);

        return devFlagConfMapper.selectOne(queryWrapper);
    }
}
